package com.mz.ozy.mvp.presenter;


import android.app.Activity;

import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.MallBean;
import com.mz.ozy.mvp.model.MallModel;
import com.mz.ozy.mvp.view.MallContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class MallPresenter extends BasePresenterImpl<MallContract.View> implements MallContract.Presenter {

    private MallModel mModel;

    public MallPresenter() {
        mModel = new MallModel();
    }


    @Override
    public void getMallInfo(Activity activity, boolean isShow) {
        mModel.getMallInfo(activity)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<MallBean>(mView, isShow) {
                    @Override
                    public void onSuccesss(MallBean bean) {
                        mView.getMallInfoSuccess(bean);
                    }
                });
    }

}
